package com.css.zfzx.data.primary.base.division.repository;


import com.css.zfzx.data.primary.base.division.repository.entity.DivisionEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BaseDivisionRepository extends JpaRepository<DivisionEntity, String> {
    @Query(
            nativeQuery = true,
            value = "select * from org_division where is_valid = '1' "
    )
    List<DivisionEntity> findAllDivison();

    //86个试点县
    @Query(nativeQuery = true,value = "select org.division_code as provinceCode from org_division org" +
            " where org.is_valid = '1' and org.pioneer_type is not null order by org.pioneer_type,org.division_code")
    List<String> findPioneerType();

    //11个试点县
    @Query(nativeQuery = true,value = "select division_code from org_division  where is_valid = '1' and " +
            "(pioneer_type ='1' or pioneer_type ='2') order by pioneer_type,division_code")
    List<String> findPioneerType1();
}
